<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <!--
         输出20以内的偶数和奇数的个数
    -->
    <script>

        var count1 = 0
        var count2 = 0
        for (var i = 1; i < 21; i++) {

            if(i%2){
                count1++;
            }else{
                count2++;
            }
        }

        console.log("奇数的个数:"+count1);
        console.log("偶数的个数:"+count2);
    </script>
</body>
</html>